function [Traj,TrajBin]=CreateTrajBinFromActiveTraj(curFrame,activeTraj,ObjectsContainedInFrames,Traj,velocityfield,params)
%ON=params.ON;
%TN=params.TN;

TrajBin=cell(params.binnedDimensions(1),params.binnedDimensions(2));

for i=1:length(activeTraj)
    TrajToProcess=Traj{activeTraj(i)};
    
    [endIndex numOfTN]=size(TrajToProcess);
    
    BaseObject=ObjectsContainedInFrames{TrajToProcess(endIndex,params.TN.frame)}(TrajToProcess(endIndex,params.TN.object),:);
    
    %Find the predicted object based on the function below
    PredictedObject = GetPredictedObject(BaseObject,velocityfield,curFrame,TrajToProcess(endIndex,params.TN.frame),params);
    
    PredictedObject(params.ON.Number)=activeTraj(i);
    
    %Place the trajectory object into the TrajBin based on its updated
    %centroid location    
    [BinX BinY]=getBinCoords(PredictedObject(params.ON.CentroidX:params.ON.CentroidY),params.binSize);
    TrajBin{BinX,BinY}(end+1,:)=PredictedObject;
    %enter the coordinates of the trajectory object in the TrajBin
    
    Traj{activeTraj(i)}(endIndex,params.TN.TBC1)=BinX;
    Traj{activeTraj(i)}(endIndex,params.TN.TBC2)=BinY;
end